#include "Transaction.hh"
#include <sstream>
#include <ctime>

Transaction::Transaction(const std::string& type, double amount,
                         const std::string& source, const std::string& dest)
    : type(type), amount(amount), sourceAccount(source), destAccount(dest) {
    time_t now = time(0);
    timestamp = ctime(&now);
}

std::string Transaction::getSummary() const {
    std::ostringstream oss;
    oss << timestamp << ": " << type << " of " << amount << " from " << sourceAccount << " to " << destAccount;
    return oss.str();
}